# Contributor: rubicon <rubicon@mailo.com>
# Maintainer:
pkgname=ocaml-pbkdf
pkgver=1.2.0
pkgrel=1
pkgdesc="Password based key derivation functions (PBKDF) from PKCS#5"
url="https://github.com/abeaumont/ocaml-pbkdf"
arch="all !riscv64"  # limited by ocaml aport
license="BSD-2-Clause"
depends="ocaml-runtime ocaml-cstruct ocaml-mirage-crypto"
depends_dev="$pkgname=$pkgver-r$pkgrel ocaml-cstruct-dev ocaml-mirage-crypto-dev"
makedepends="$depends_dev dune ocaml"
checkdepends="ocaml-alcotest-dev"
options="!check"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/abeaumont/ocaml-pbkdf/archive/$pkgver.tar.gz"
_ocamldir=usr/lib/ocaml

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	dune build --release --verbose
}

check() {
	dune runtest --verbose
}

package() {
	dune install \
		--destdir="$pkgdir" \
		--docdir=/.omit
	rm -Rf "$pkgdir"/.omit
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find $_ocamldir \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
d6f7d5efd761b87dd420ddcf97c2f9d4402dcc81d65cd1f4d81039b70c4d8c1e803bbaf4251482de8de7076da9f40b48c7eb1684e31e7a316deb5036c192bd3c  ocaml-pbkdf-1.2.0.tar.gz
"
